package main

import (
    "github.com/gin-gonic/gin"
    "net/http"
)

func main() {
    r := gin.Default()
    g := r.Group("/group1")
    g.GET("/get", func(c *gin.Context) {
        name := c.Query("name")
        c.JSON(http.StatusOK, gin.H{
            "message": "group1",
            "name": name,
        })
    })
    r.GET("/ping", func(c *gin.Context) {
        name := c.Query("name")
        c.JSON(http.StatusOK, gin.H{
            "message": "pong",
            "name": name,
        })
    })
    r.GET("/hello", func(c *gin.Context) {
        name := c.Query("name")
        c.JSON(http.StatusOK, gin.H{
            "message": "fkxxyz",
            "name": name,
        })
    })
	r.GET("/test", func(c *gin.Context) {
		c.Redirect(http.StatusMovedPermanently, "https://fkxxyz.coding.net/p/test/d/test-gin/git/raw/master/gin-test")
	})
    r.Run()
}

